#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QTcpServer>
#include <QTcpSocket>
#include <QWebSocketServer>
#include <QWebSocket>

namespace Ui {
class Widget;
}

class Widget : public QWidget
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = 0);
    ~Widget();

private slots:
    void on_pushButton_clicked();

    void on_pushButton_2_clicked();
    void serve_new_connect();
    void serve_read_data();
    void serve_send_data();
    void disconnect_socket();


private:
    Ui::Widget *ui;
    QTcpServer* m_tcps;
    QTcpSocket*  tcpsocket;
    QList<QTcpSocket*> tcp_sockets;
    int clint_num;
    QByteArray buffer;
    QWebSocket* socket;
    QWebSocketServer *server;
    void star_game();
    void onNewConnection();
signals:
    void data_get();
    void sendMessage(const QString &text);

};

#endif // WIDGET_H
